package test.example.customview;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;



public class CustomPopupWindowActivity extends Activity {
    private ListView listView;
    Button btn;
    InfoPopup infoPopup;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        registerComponents();
        
        //  set up listview
        infoPopup = new InfoPopup(btn);
        listView = (ListView)infoPopup.getScroller();
        
        String[]  data = new String[]{"aaaaa", "bbbbb"};
        listView.setAdapter(new ArrayAdapter<String>(getApplicationContext(), R.layout.list_item, data) );
    }
    
    private void registerComponents(){
    	btn = (Button) findViewById(R.id.btn);    	
    	btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				infoPopup.show();
			}
		});
    }
}